

<template>

  <login
      :title="errortitle"
      :text="errorval"
      v-if="!this.$cfg.user.authkey"
  />
  <n-card v-else :bordered="border">

    <div >
      <n-h3>{{ errortitle }}</n-h3>
    <n-card style="padding-left: 15px;" vertical :offset="1"  :bordered="border2">
      <p>许可用户组：<template v-for="item in pd_group">{{ $langgroup[item] }} ,</template></p>
      <p>当前用户组：<template v-for="item,key in $cfg.user.group">{{ $langgroup[key] }} , </template></p>
      <n-hr></n-hr>
      <p>{{ errorval }}</p>
    </n-card>
    </div>
  </n-card>
</template>

<script>
export default {
  props: ['group','pd',"errortitle","border","border2","errorval"],
  inject: ['$cfg'],
  mounted() {


    this.pd_group.forEach(function(item, index) {
      let up = 0;
      if (this.$cfg && this.$cfg.user && this.$cfg.user.group) {
        if (this.$cfg.user.group[item] ?? false == true) {
         up = 1;
       }
     }
      if(up == 1){
        this.$emit('update', 1);
      }else{
        this.$emit('update', 0);
      }
    }, this);

  },
  data() {
    let pd_group = this.group;
    return{
      pd_group,
    }
  },
};
</script>